package senpec.qc.harmony.system.role.menu;

import org.springframework.web.bind.annotation.*;
import senpec.qc.harmony.base.mybatisplus.IBaseControllerImpl;
import senpec.qc.harmony.base.mybatisplus.Result;

import java.util.List;

@RestController
@RequestMapping("/system/role/menu")
public class MenuController extends IBaseControllerImpl<Menu, MenuService> {
    private final MenuService menuService;

    public MenuController(MenuService baseService, MenuService menuService) {
        super(baseService);
        this.menuService = menuService;
    }

    @PutMapping("/resetMenusByRoleId")
    public Result<?> resetMenusByRoleId(MenuDTO menuDTO) {
        return menuService.resetMenusByRoleId(menuDTO);
    }

    @GetMapping("/userId/{userId}")
    public Result<List<String>> getMenuListByUserid(@PathVariable("userId") Long userId) {
        return menuService.getMenuTitleListByUserId(userId);
    }
}